Skip to content

refactor: migrate Studio Home caller to standardized v3 API (FC-0118)#3140

Draft
taimoor-ahmed-1 wants to merge 1 commit into
openedx:masterfrom
taimoor-ahmed-1:taimoor-ahmed/migrate-course-home-v3
Draft

refactor: migrate Studio Home caller to standardized v3 API (FC-0118)#3140
taimoor-ahmed-1 wants to merge 1 commit into
openedx:masterfrom
taimoor-ahmed-1:taimoor-ahmed/migrate-course-home-v3

Conversation

@taimoor-ahmed-1

Copy link
Copy Markdown

⛔ Draft — blocked by #2540 (do not merge yet)

This PR is intentionally opened as a draft. It is item #2 of the FC-0118
Studio-API caller migration tracked in #3127,
and it is on hold pending #2540 (the "Studio Home" Redux → React Query +
Context refactor). #2540 intends to break the kitchen-sink Studio Home state
(course list, library list, permissions, feature flags, branding) into smaller,
purpose-specific queries; versioning this endpoint as-is would entrench a payload
shape we plan to remove. Do not merge until #2540's direction is settled.

Merge order / dependencies

Description

Migrates the Studio Home landing page and libraries tab reads from the
v1 endpoint to the standardized v3 endpoint (FC-0118, ADR 0028/0037):

  • getStudioHomeApiUrl() now targets …/api/contentstore/v3/home/ instead of
    …/v1/home. The v3 HomeViewSet is served by a DRF DefaultRouter, so the
    URL now carries the required trailing slash.
  • getStudioHomeDataGET …/v3/home/ (the aggregated list action).
  • getStudioHomeLibrariesGET …/v3/home/libraries/ (the libraries
    action). The helper builds home/libraries/ off the trailing-slash base.

The default (full) response shape is unchanged between v1 and v3 (ADR 0036
?fields= presets are opt-in and default to the full payload), so this is a
behaviour-preserving swap.

Supporting information

Testing instructions

  1. npm ci
  2. npx jest src/studio-home
  3. Manual: open Studio Home, confirm the landing page and the Libraries tab load,
    and that the network tab shows requests to /api/contentstore/v3/home/ and
    /api/contentstore/v3/home/libraries/.

Other information

  • Files changed:
    • src/studio-home/data/api.ts — v3 base URL + trailing slash; libraries/
      concatenation fixed for the trailing-slash base.
    • src/studio-home/data/api.test.js — bump the hardcoded libraries mock to v3.
  • The ~15 other test files that mock getStudioHomeApiUrl() reference it by
    function
    , so they track the new URL automatically.
  • src/studio-home (113 tests) passes; dprint check is clean. The only
    library-authoring failures in a broad run are pre-existing, date-dependent
    flakes on master
    (identical failure set with and without this change).

FC-0118 (ADR 0028/0037): point the Studio Home landing + libraries-tab reads
at the new standardized `/api/contentstore/v3/home/` endpoint instead of v1.
The v3 `HomeViewSet` is served by a DRF DefaultRouter, so the URLs now carry
the required trailing slash:
- `getStudioHomeData`      → GET `…/v3/home/`            (list action)
- `getStudioHomeLibraries` → GET `…/v3/home/libraries/`  (libraries action)

`getStudioHomeApiUrl()` now returns the trailing-slash base, and
`getStudioHomeLibraries` builds `…home/libraries/` off it (no leading slash).
The default (full) response shape is unchanged between v1 and v3 (ADR 0036
`?fields=` presets are opt-in and default to the full payload), so this is a
behaviour-preserving swap.

Test mocks that reference `getStudioHomeApiUrl()` update automatically; the
one hardcoded libraries URL in `api.test.js` is bumped to the v3 path.

Refs openedx#3127

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 16, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @taimoor-ahmed-1!

This repository is currently maintained by @bradenmacdonald.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.77%. Comparing base (c1da7f4) to head (2df8d3c).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3140      +/-   ##
==========================================
+ Coverage   95.76%   95.77%   +0.01%     
==========================================
  Files        1396     1396              
  Lines       33308    33399      +91     
  Branches     7820     7855      +35     
==========================================
+ Hits        31897    31988      +91     
- Misses       1352     1367      +15     
+ Partials       59       44      -15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Jul 20, 2026
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

3 participants